package com.youlu.campus.web.wechat;

import com.alibaba.fastjson.JSON;
import com.youlu.campus.entity.WechatAuthBlackList;
import com.youlu.campus.service.wechat.WechatAuthBlackListService;
import com.yuelin.infrastructure.quantum.common.QResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;

@Slf4j
@RestController
public class WechatAuthBlackListController {
    @Autowired
    private WechatAuthBlackListService wechatAuthBlackListService;

    @GetMapping("/public/wechat/auth-black-list/find")
    public QResult getWechatAuthBlackList(@RequestParam("sysAppId") @NotNull String sysAppId) {
        log.info(":>>> 开始获取 WechatAuthBlackList:{}", sysAppId);
        WechatAuthBlackList data = wechatAuthBlackListService.findBySysAppId(sysAppId);
        log.info(":>>> sysAppId:{} 授权黑名单为:{}", sysAppId, JSON.toJSON(data));
        return QResult.success(data);
    }
}
